package Day01;

import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import java.util.Scanner;

public class integration {
    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入: 1关机 2计算器 3记事本 4取消关机 5广告 6生成病毒 7打开tim");
        int a = sc.nextInt();

        if (a == 1) {
            Runtime.getRuntime().exec("shutdown -s");
        }
        if (a == 2) {
            Runtime.getRuntime().exec("calc");
        }
        if (a == 3) {
            Runtime.getRuntime().exec("notepad");
        }
        if (a == 4) {
            Runtime.getRuntime().exec("shutdown -a");
        }
        if (a == 5) {
            Frame gg = new Frame();
            gg.setSize(1000,40);
            gg.setBackground(Color.BLACK);
            gg.setUndecorated(true);  //取消装饰
            gg.setAlwaysOnTop(true);
            gg.setVisible(true);
            int x=1440;  //从哪开始出现
            for(;;){
                gg.setLocation(x,0);
                x-=2;  //每次循环x坐标减2，往左移动
                Thread.sleep(15);  //缓冲 ，避免卡顿
                if(x< - 1000){  //移动到左边-1000的位置，再移回来
                    x=1440;  //屏幕宽度
                }
            }
        }
        if (a == 6) {
            Random rd = new Random();
            for (;;){
                File panda = new File("E:\\engineering-practice\\campus\\熊猫烧香"+rd.nextInt(1000)+".exe");
                panda.createNewFile();
                Thread.sleep(1000);
            }
        }
        if (a == 7) {
            File q = new File("D:\\Tim\\install\\Bin\\QQScLauncher.exe");
            Desktop.getDesktop().open(q);  //打开该软件
        }
    }
}